home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
lisp
/
elk-2_0.lha
/
elk-2.0
/
util
/
alloca.c
next >
Wrap
C/C++ Source or Header
|
1992-10-23
|
671b
|
30 lines
/* Check if the system's alloca() function actually extends the stack.
* If it doesn't, it's not usable for Elk.
*
* The second value printed should be about 100 larger (or smaller,
* depending on the stack growing direction) than the first value.
*
* On some systems you may have to delete the #include, or the line
* declaring alloca(), or both.
*/
extern char *alloca();
char *stkbase;
prstk(s) char *s; {
char foo;
printf("stack %s calling alloca(100): %lu\n", s, (long)(stkbase - &foo));
}
main(ac, av) char **av; {
char *foo;
stkbase = (char *)&foo;
prstk("before");
foo = alloca(100);
prstk(" after");
return 0;
}